<template>
  <el-dialog v-model="open" :title="title" width="1000px" append-to-body :close-on-click-modal="false">

    <el-table v-loading="loading" :data="tableData">
      <el-table-column type="index" label="序号" width="80" align="center" />
      <el-table-column label="姓名" prop="memberName" min-width="100" />
      <el-table-column label="手机号" prop="memberTelno" min-width="160" />
      <el-table-column label="退卡金额" prop="orderValue" min-width="120" />
      <el-table-column label="退卡方式" prop="payTypeStr" min-width="120" />
      <el-table-column label="备注" prop="remark" min-width="120" />
	  <el-table-column label="操作" align="center" fixed="right" class-name="small-padding" width="100">
	    <template #default="scope">
			<el-tag v-if="scope.row.refundConfirm==2">已确认</el-tag>
			<el-button v-else type="text" @click="check(scope.row)">退款确认</el-button>
	    </template>
	  </el-table-column>
    </el-table>
    <pagination
      v-show="total > 0"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      :total="total"
      @pagination="getList"
    />
  </el-dialog>
</template>

<script setup>
import { getCurrentInstance, reactive } from '@vue/runtime-core'
import { watch } from 'vue'
import { toRefs } from '@vueuse/shared'
import { confirmList,refundConfirm } from '../../../../../api/ven/member'

const { proxy } = getCurrentInstance()
const loading = ref(false)
const props = defineProps({
  props: {
    type: Object,
    default: () => ({
      open: false,
      title: ''
    })
  }
})
const emit = defineEmits(['submitForm'])
const tableData = ref([])
const total = ref('')

const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10
  }
})
const { open, title } = toRefs(props.props)
const { queryParams } = toRefs(data)

watch(open, (val) => {
  // queryParams.value.memberId = props.props.data.id
	loading.value = false
  getList()
})

function getList() {
  confirmList(queryParams.value).then((res) => {
	loading.value = false
    tableData.value = res.data.rows
    total.value = res.data.total
  })
}

function cancel() {
  open.value = false
}

function check(row){
	refundConfirm(row.id).then(res=>{
		proxy.$modal.msgSuccess(res.msg)
		getList()
	})
}

</script>

<style scoped lang="scss">

</style>
